package org.iamd.conf;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Map;
import java.util.Properties;

import org.apache.log4j.PropertyConfigurator;

/**
 * Инициализация на Log компонентата.
 * 
 * @author И. Атанасов
 */
public class Log4jConfigurationFactory implements ConfigurationFactory {

	/**
	 * Стандартна инициализация.
	 * 
	 * @see org.iamd.conf.ConfigurationFactory#initializeComponent(java.util.Map,
	 *      java.io.File)
	 */
	@Override
	public void initializeComponent(Map<String, String> params, File configFile)
			throws InitializationException {
		try {
			InputStream input = new FileInputStream(configFile);
			Properties props = new Properties();
			props.load(input);
			PropertyConfigurator.configure(props);
		} catch (Exception e) {
			throw new InitializationException(e);
		}
	}

}